package com.palrevo.data.models;

import java.util.ArrayList;
import java.util.List;

import com.palrevo.data.services.ServiceBase.Columns;
import com.palrevo.data.services.ServiceBase.Tables;

/**
 * 
 * @author AAsha
 * 
 */
@SuppressWarnings("serial")
public class User implements Model {

	private Long id;
	private String username;
	private String password;

	public User() {
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Override
	public String getTableName() {
		return Tables.users.name();
	}

	@Override
	public List<String> getFields() {
		List<String> fields = new ArrayList<String>();

		fields.add(Columns.ID.name());
		fields.add(Columns.USERNAME.name());
		fields.add(Columns.PASSWORD.name());

		return fields;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (id != null ? id.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {

		if (!(object instanceof User)) {
			return false;
		}

		User other = (User) object;

		if ((this.id == null && other.id != null)
				|| (this.id != null && !this.id.equals(other.id))) {
			return false;
		}

		return true;
	}

	@Override
	public String toString() {
		return "id = [" + id + "]";
	}

}
